#ifndef TEMPLATE_UTIL_HPP
#define TEMPLATE_UTIL_HPP

#include <sys/stat.h>
#include <string>
#include <cpp3ds/Network/Http.hpp>
#include <cpp3ds/System/String.hpp>
#ifndef EMULATION
#include <3ds.h>
#endif

namespace Template
{

bool pathExists(const char* path, bool escape = true);
bool fileExists (const std::string& name);
void makeDirectory(const char *dir, mode_t mode = 0777);
int removeDirectory(const char *path, bool onlyIfEmpty = false);
void hexToRGB(std::string hexValue, int *R, int *G, int *B);
std::string ReplaceAll(std::string str, const std::string& from, const std::string& to);
cpp3ds::String getUsername();
template<typename Out> void split(const std::string &s, char delim, Out result);
std::vector<std::string> split(const std::string &s, char delim);

#ifndef EMULATION
Result fsReadFile(u8 *buffer, const char *filePath, int fileSize, FS_ArchiveID archiveId);
Result fsWriteFile(void *buffer, u32 size, const char *filename, FS_ArchiveID archiveId);
#endif

} // namespace Template

#endif // TEMPLATE_UTIL_HPP
